package shaw.wifi.gui;

import shaw.wifi.NetworkSettingsTaskRunner;
import shaw.wifi.NetworkSettingsTaskManager;
import shaw.wifi.network.ConnectionInformation;
import android.view.View;
import android.view.View.OnClickListener;

public class ConnectButtonListener implements OnClickListener {
	public void onClick(View v) {
		if(NetworkSettingsTaskManager.get().getNSTR().getState() == NetworkSettingsTaskRunner.AVAILABLE) {
			//set appropriate user info
			NetworkSettingsTaskManager.get().getConnInfo().disableShawOpen = SecureConnectGui.get().getDisableOpen();
			//run task
			NetworkSettingsTaskManager.get().runTasks();
		} else if(NetworkSettingsTaskManager.get().getNSTR().getState()  == NetworkSettingsTaskRunner.CONNECTING) {
			NetworkSettingsTaskManager.get().getNSTR().cancelTask();
		}
	}
}
